package com.onluy.frameworkcloud.system.bind;


import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import com.onluy.frameworkcloud.tools.utils.ReflectionUtils;

public class RequestMappingHandlerAdapterAdjust implements InitializingBean {
    private RequestMappingHandlerAdapter requestMappingHandlerAdapter;

    public void setRequestMappingHandlerAdapter(RequestMappingHandlerAdapter requestMappingHandlerAdapter) {
        this.requestMappingHandlerAdapter = requestMappingHandlerAdapter;
    }

    public void afterPropertiesSet() throws Exception {
        ArrayList allArgumentResolvers = new ArrayList();
        List frontArgumentResolvers = this.requestMappingHandlerAdapter.getArgumentResolvers();
        List defaultArgumentResolvers = (List) ReflectionUtils.invoke(this.requestMappingHandlerAdapter,
                "getDefaultArgumentResolvers", (Object[]) null, (Class[]) null);
        allArgumentResolvers.addAll(frontArgumentResolvers);
        allArgumentResolvers.addAll(defaultArgumentResolvers);
        this.requestMappingHandlerAdapter.setArgumentResolvers(allArgumentResolvers);
    }
}